/*
 * @Author: 小巴 2393953821@qq.com
 * @Date: 2024-05-30 14:24:13
 * @LastEditors: 小巴 2393953821@qq.com
 * @LastEditTime: 2024-06-04 17:20:15
 * @FilePath: \drgs_web\src\api\user.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/pc/home/login',
    method: 'post',
    data
  })
}


export function getInfo() {
  return request({
    url: '/pc/home/user-info',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/pc/home/logout',
    method: 'get'
  })
}

export function userPage(data,flag) {
  return request({
    url: `/pc/user/page?flag=${flag.data}`,
    method: 'post',
    data
  })
}

export function useradd(data,flag) {
  return request({
    url: `pc/user/add?flag=${flag.data}`,
    method: 'post',
    data
  })
}

export function userdetail(data,flag) {
  return request({
    url: `/pc/user/detail?id=${data.id}&flag=${flag.data}`,
    method: 'get'
  })
}

export function userupdate(data,flag) {
  return request({
    url: `pc/user/update?flag=${flag.data}`,
    method: 'post',
    data
  })
}

// 获取已分配的角色
export function usergetallocationl(data,flag) {
  return request({
    url: `pc/user/get-allocation?id=${data.id}&flag=${flag.data}`,
    method: 'get'
  })
}

// 分配角色
export function userallocationl(data,flag) {
  return request({
    url: `pc/user/allocation?flag=${flag.data}`,
    method: 'post',
    data
  })
}
//删除
export function userdel(data,flag) {
  return request({
    url: `pc/user/del?id=${data.id}&flag=${flag.data}`,
    method: 'get'
  })
}

// 获取图形验证码
export function sendCode(data,flag) {
  return request({
    url: `/home/img-code?flag=${flag.data}`,
    method: 'get'
  })
}
